package kr.hkit.powerjava.chapter22.collection;

import java.util.HashMap;
import java.util.Map;

import kr.hkit.powerjava.chapter22.work2.vo.Student;

public class MapTest {
	public static void main(String[] args) {
		Map<Integer, Student> map = new HashMap<>();
		map.put(1, new Student(1, "김태희", 90, 90, 90));			//map.put(key,value)
		map.put(2, new Student(2, "이연희", 85, 100, 100));
		map.put(3, new Student(3, "임수정", 100, 100, 100));
		map.remove(1);		//key값으로 삭제
		
		System.out.println(map);
		
		for (Map.Entry<Integer, Student> s: map.entrySet()) {
			int key = s.getKey();								//s.getkey = s의 key값을 get
			Student std = s.getValue();							//s.getValue() = s의 value값을 get
			
			System.out.println("Key : " + key + " Value : " + std);
		}
		
	}
}
